package com.hanyao.reggie.common;

import org.springframework.stereotype.Component;

/**
 * 工具类，用于将数据获取和存入ThreadLocal
 * @author 寒钥
 * @version 1.0
 */
public class BaseContext {
    private static ThreadLocal<Long> threadLocal= new ThreadLocal();

    public static void setCurrentId(Long id){
        //ThreadLocal有两个方法，分别是set和get对应的功能就是在threadlocal中传入值和取出值
        threadLocal.set(id);
    }
    public static Long getCurrentId(){
        return threadLocal.get();
    }
}
